package com.homework2.demo2;

import java.util.HashSet;

public class SchoolClass {

    private String name;
    //班级内的所有学生
    private HashSet<Student> students;

    public SchoolClass(String name) {
        this.name = name;
    }

    public SchoolClass(String name, HashSet<Student> students) {
        this.name = name;
        this.students = students;
    }

    public HashSet<Student> getStudents() {
        return students;
    }

    public void setStudents(HashSet<Student> students) {
        this.students = students;
    }



    public void addStudent(Student student) {
        students.add(student);
    }

    public void removeStudent(String name) {
        Student student = students.iterator().next();
        if (student.getName().equals(name)) {
            students.remove(student);
        }

    }
}
